package com.lanou.dllo.vc.dao;

import com.lanou.dllo.vc.greendao.UserInfo;
import com.lanou.dllo.vc.greendao.UserInfoDao;

import java.util.List;

/**
 * Created by dllo on 15/11/17.
 */
public class UserInfoDBhelper implements DBHoldable<UserInfo> {
    private DaoSingleton instance = DaoSingleton.getInstance();
    private UserInfoDao userInfoDao;

    public UserInfoDBhelper() {
        this.userInfoDao = instance.getUserInfoDao();
    }

    //存储
    @Override
    public void saveData(UserInfo entities) {
        //将集合中的数据的每一个元素添加一条属性tag,用于区分集合
        userInfoDao.insertOrReplace(entities);
    }

    //根据标签查询数据

    @Override
    public UserInfo readDate(String username) {
        return userInfoDao.queryBuilder().where(UserInfoDao.Properties.Username.eq(username)).list().get(0);
    }


//

}
